package com.layui.ad.utils;

import com.layui.ad.entity.SysAdmin;
import com.layui.ad.mapper.SysAdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

@Component
public class AdminUtils {

    @Autowired
    public  SysAdminMapper sysAdminMapper;

    public static AdminUtils adminUtils;

    @PostConstruct
    public void init() {
        adminUtils = this;
    }


    public static String  getAdminName(Integer adminId){
        SysAdmin sysAdmin = adminUtils.sysAdminMapper.selectById(adminId);
        if(sysAdmin!=null) {
            return sysAdmin.getRealname();
        }else{
            return "";
        }
    }
}
